/*
 * Copyright 2015-2016 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
 *
 * You may not use this file except in compliance with the terms and conditions set forth
 * in the accompanying LICENSE.TXT file.
 *
 * THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS.  AMAZON SPECIFICALLY DISCLAIMS, WITH
 * RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
 */

package com.amazon.alexa.voicechrome.internal.views;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;

import com.amazon.alexa.voicechrome.R;

/**
 * A container object for abstracting the composition of the SpeechUi privacy, dnd, and unavailable views.
 */
public class StaticView extends ChromeTransitionView {

    private View gradientView;
    private View barView;

    public StaticView(Context context) {
        super(context);
        initView(context);
    }

    public StaticView(Context context, AttributeSet attrSet) {
        super(context, attrSet);
        initView(context);
    }

    public StaticView(Context context, AttributeSet attrSet, int defStyleAttr) {
        super(context, attrSet, defStyleAttr);
        initView(context);
    }

    private void initView(Context context) {
        LayoutInflater.from(context).inflate(R.layout.voicechrome_static_view, this);

        barView = findViewById(R.id.bar_view);
        gradientView = findViewById(R.id.gradient);
    }

    public void setGradientDrawable(int gradientColor) {
        gradientView.setBackground(ContextCompat.getDrawable(getContext(), gradientColor));

    }

    public void setBarColor(int color) {
        barView.setBackgroundColor(ContextCompat.getColor(getContext(), color));
    }
}
